package com.qingcheng.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.qingcheng.dao.OrderMapper;
import com.qingcheng.dao.TradeStatisticsMapper;
import com.qingcheng.pojo.order.Order;
import com.qingcheng.pojo.order.TradeStatistics;
import com.qingcheng.service.order.TradeStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDate;
import java.util.List;

@Service
public class TradeStatisticsServiceImpl implements TradeStatisticsService {

    @Autowired
    private TradeStatisticsMapper tradeStatisticsMapper;

    @Autowired
    private OrderMapper orderMapper;


    /**
     * 交易统计定时任务
     */
    @Override
    public void createTrade() {

        LocalDate localDate = LocalDate.now().minusDays(1);


        TradeStatistics TradeStatistics = orderMapper.findOrders(localDate);


        tradeStatisticsMapper.insert(TradeStatistics);

    }
}
